#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int N=405;

int m,n;
int dp[N][N]; 
char s[N];

int cut(int l,int r)
{
	int ans=0;
	for (int i=l;i<=r;i++) ans=ans*10+s[i]-'0';
	return ans;
}

int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	scanf("%d",&m);
	
	for (int i=1;i<=n;i++)
	{
		dp[i][0]=cut(1,i);
		for (int a=1;a<=m;a++) 
		{
			for (int j=1;j<i;j++) 
			dp[i][a]=max(dp[i][a],dp[j][a-1]*cut(j+1,i)); 
		}
	}
	printf("%d",dp[n][m]);
	return 0;
}
